Op prio
このページを編集する際は，編集に関する方針に従ってください． 概要 *gcc-4.1.0/gcc/tree-pretty-print.cにて定義 *演算子の優先度を返す 引数 *tree op ** 実装 1699 /* Return the priority of the operator OP. 1700 1701 From lowest to highest precedence with either left-to-right (L-R) 1702 or right-to-left (R-L) associativity]: 1703 1704 1 L-R , 1705 2 R-L = += -= *= /= %= &= ^= |= <<= >>= 1706 3 R-L ?: 1707 4 L-R || 1708 5 L-R && 1709 6 L-R | 1710 7 L-R ^ 1711 8 L-R & 1712 9 L-R != 1713 10 L-R < <= > >= 1714 11 L-R << >> 1715 12 L-R + - 1716 13 L-R * / % 1717 14 R-L ! ~ ++ -- + - * & (type) sizeof 1718 15 L-R fn() [] -> . 1719 1720 unary +, - and * have higher precedence than the corresponding binary 1721 operators. */ 1722 1723 static int 1724 op_prio (tree op) 1725 { 1726 if (op NULL) 1727 return 9999; 1728 *TREE_CODEの帰り値はenum tree_code型 1729 switch (TREE_CODE (op)) 1730 { 1731 case TREE_LIST: 1732 case COMPOUND_EXPR: 1733 case BIND_EXPR: 1734 return 1; 1735 1736 case MODIFY_EXPR: 1737 case INIT_EXPR: 1738 return 2; 1739 1740 case COND_EXPR: 1741 return 3; 1742 1743 case TRUTH_OR_EXPR: 1744 case TRUTH_ORIF_EXPR: 1745 return 4; 1746 1747 case TRUTH_AND_EXPR: 1748 case TRUTH_ANDIF_EXPR: 1749 return 5; 1750 1751 case BIT_IOR_EXPR: 1752 return 6; 1753 1754 case BIT_XOR_EXPR: 1755 case TRUTH_XOR_EXPR: 1756 return 7; 1757 1758 case BIT_AND_EXPR: 1759 return 8; 1760 1761 case EQ_EXPR: 1762 case NE_EXPR: 1763 return 9; 1764 1765 case UNLT_EXPR: 1766 case UNLE_EXPR: 1767 case UNGT_EXPR: 1768 case UNGE_EXPR: 1769 case UNEQ_EXPR: 1770 case LTGT_EXPR: 1771 case ORDERED_EXPR: 1772 case UNORDERED_EXPR: 1773 case LT_EXPR: 1774 case LE_EXPR: 1775 case GT_EXPR: 1776 case GE_EXPR: 1777 return 10; 1778 1779 case LSHIFT_EXPR: 1780 case RSHIFT_EXPR: 1781 case LROTATE_EXPR: 1782 case RROTATE_EXPR: 1783 return 11; 1784 1785 case PLUS_EXPR: 1786 case MINUS_EXPR: 1787 return 12; 1788 1789 case MULT_EXPR: 1790 case TRUNC_DIV_EXPR: 1791 case CEIL_DIV_EXPR: 1792 case FLOOR_DIV_EXPR: 1793 case ROUND_DIV_EXPR: 1794 case RDIV_EXPR: 1795 case EXACT_DIV_EXPR: 1796 case TRUNC_MOD_EXPR: 1797 case CEIL_MOD_EXPR: 1798 case FLOOR_MOD_EXPR: 1799 case ROUND_MOD_EXPR: 1800 return 13; 1801 1802 case TRUTH_NOT_EXPR: 1803 case BIT_NOT_EXPR: 1804 case POSTINCREMENT_EXPR: 1805 case POSTDECREMENT_EXPR: 1806 case PREINCREMENT_EXPR: 1807 case PREDECREMENT_EXPR: 1808 case NEGATE_EXPR: 1809 case ALIGN_INDIRECT_REF: 1810 case MISALIGNED_INDIRECT_REF: 1811 case INDIRECT_REF: 1812 case ADDR_EXPR: 1813 case FLOAT_EXPR: 1814 case NOP_EXPR: 1815 case CONVERT_EXPR: 1816 case FIX_TRUNC_EXPR: 1817 case FIX_CEIL_EXPR: 1818 case FIX_FLOOR_EXPR: 1819 case FIX_ROUND_EXPR: 1820 case TARGET_EXPR: 1821 return 14; 1822 1823 case CALL_EXPR: 1824 case ARRAY_REF: 1825 case ARRAY_RANGE_REF: 1826 case COMPONENT_REF: 1827 return 15; 1828 1829 /* Special expressions. */ 1830 case MIN_EXPR: 1831 case MAX_EXPR: 1832 case ABS_EXPR: 1833 case REALPART_EXPR: 1834 case IMAGPART_EXPR: 1835 case REDUC_MAX_EXPR: 1836 case REDUC_MIN_EXPR: 1837 case REDUC_PLUS_EXPR: 1838 case VEC_LSHIFT_EXPR: 1839 case VEC_RSHIFT_EXPR: 1840 return 16; 1841 1842 case SAVE_EXPR: 1843 case NON_LVALUE_EXPR: 1844 return op_prio (TREE_OPERAND (op, 0)); 1845 1846 default: 1847 /* Return an arbitrarily high precedence to avoid surrounding single 1848 VAR_DECLs in ()s. */ 1849 return 9999; 1850 } 1851 }